import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from "vuex-persistedstate"
import cookies from "vue-cookies";



Vue.use(Vuex)

export default new Vuex.Store({
  plugins: [createPersistedState({
    storage: window.sessionStorage,
    // 方法1：用reducer，这里的val是由store里面的所有state，不加reducer为储存所有，reducer为指定存储
    // reducer(val) {
    //   return {
    //     // 只储存state中的name
    //     keyName: val.name
    //   }
    // }
    // 方法2：用paths,数组里面填模块名，存储指定模块
    // paths: ['Home', 'Order']
  })],

  state: {
    token: "",
    isDL: false,
    user: []
  },
  getters: {
  },
  mutations: {
    getToken(state,t){
      state.token = t
    },
    getDL(state,v){
      state.isDL = v
    },
    getuser(state,n){
      state.user = n
    }
  },
  actions: {

  },
  modules: {
  }
})
